/*
 * @Description: web端新闻服务
 */

const NewsModel = require("../../models/NewsModel")

const NewsService = {
  getList: async (id) => {
    return id ? NewsModel.find({ _id: id, isPublish: 1 },) : NewsModel.find({ isPublish: 1 },).sort({ endTime: -1 })
  },
  getTopList: async ({ limit }) => {
    return NewsModel.find({ isPublish: 1 },).sort({ endTime: -1 }).limit(limit)
  },
}
module.exports = NewsService
